package ca.garagan.jennadecoder.client;

import ca.garagan.jennadecoder.shared.FieldVerifier;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.dom.client.KeyUpEvent;
import com.google.gwt.event.dom.client.KeyUpHandler;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.HorizontalSplitPanel;
import com.google.gwt.user.client.ui.VerticalSplitPanel;
import com.google.gwt.user.client.ui.TextArea;
import com.google.gwt.user.client.ui.ValueBoxBase.TextAlignment;
import com.google.gwt.user.client.ui.TextBoxBase;
import com.google.gwt.user.client.ui.LayoutPanel;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.ui.RadioButton;
import com.google.gwt.user.client.ui.ValuePicker;
import com.google.gwt.user.cellview.client.CellList;
import com.google.gwt.cell.client.TextCell;
import com.google.gwt.user.client.ui.ListBox;
import com.google.gwt.user.client.ui.Image;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class JennaDecoder implements EntryPoint {
	/**
	 * The message displayed to the user when the server cannot be reached or
	 * returns an error.
	 */
	private static final String SERVER_ERROR = "An error occurred while "
			+ "attempting to contact the server. Please check your network "
			+ "connection and try again.";

	/**
	 * Create a remote service proxy to talk to the server-side Greeting service.
	 */
	private final GreetingServiceAsync greetingService = GWT
			.create(GreetingService.class);

	/**
	 * This is the entry point method.
	 */
	public void onModuleLoad() {

		// Add the nameField and sendButton to the RootPanel
		// Use RootPanel.get() to get the entire body element
		RootPanel rootPanel = RootPanel.get("nameFieldContainer");
		
		HorizontalSplitPanel horizontalSplitPanel = new HorizontalSplitPanel();
		rootPanel.add(horizontalSplitPanel, 10, 10);
		horizontalSplitPanel.setSize("539px", "357px");
		
		VerticalSplitPanel verticalSplitPanel = new VerticalSplitPanel();
		horizontalSplitPanel.setLeftWidget(verticalSplitPanel);
		verticalSplitPanel.setSize("100%", "100%");
		
		LayoutPanel layoutPanel_1 = new LayoutPanel();
		verticalSplitPanel.setTopWidget(layoutPanel_1);
		layoutPanel_1.setSize("100%", "100%");
		
		TextArea textArea = new TextArea();
		layoutPanel_1.add(textArea);
		textArea.setAlignment(TextAlignment.LEFT);
		textArea.setSize("95%", "70%");
		
		RadioButton toEncodedButton = new RadioButton("new name", "To encoded");
		toEncodedButton.setValue(true);
		layoutPanel_1.add(toEncodedButton);
		layoutPanel_1.setWidgetLeftWidth(toEncodedButton, 10.0, Unit.PX, 117.0, Unit.PX);
		layoutPanel_1.setWidgetTopHeight(toEncodedButton, 141.0, Unit.PX, 20.0, Unit.PX);
		
		RadioButton fromEncodedButton = new RadioButton("new name", "From encoded");
		fromEncodedButton.setFormValue("toFromSelect");
		toEncodedButton.setFormValue("toFromSelect");
		layoutPanel_1.add(fromEncodedButton);
		layoutPanel_1.setWidgetLeftWidth(fromEncodedButton, 133.0, Unit.PX, 117.0, Unit.PX);
		layoutPanel_1.setWidgetTopHeight(fromEncodedButton, 141.0, Unit.PX, 20.0, Unit.PX);
		
		LayoutPanel layoutPanel_2 = new LayoutPanel();
		verticalSplitPanel.setBottomWidget(layoutPanel_2);
		layoutPanel_2.setSize("100%", "100%");
		
		TextArea textArea_1 = new TextArea();
		layoutPanel_2.add(textArea_1);
		textArea_1.setSize("95%", "70%");
		
		LayoutPanel layoutPanel = new LayoutPanel();
		horizontalSplitPanel.setRightWidget(layoutPanel);
		layoutPanel.setSize("100%", "100%");
		
		Button okButton = new Button("OK");
		okButton.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {
			}
		});
		layoutPanel.add(okButton);
		layoutPanel.setWidgetLeftWidth(okButton, 30.0, Unit.PX, 100.0, Unit.PX);
		layoutPanel.setWidgetTopHeight(okButton, 311.0, Unit.PX, 35.0, Unit.PX);
		
		Button cancelButton = new Button("Cancel");
		layoutPanel.add(cancelButton);
		layoutPanel.setWidgetLeftWidth(cancelButton, 136.0, Unit.PX, 100.0, Unit.PX);
		layoutPanel.setWidgetTopHeight(cancelButton, 311.0, Unit.PX, 35.0, Unit.PX);
		
		Image image = new Image("552.jpg");
		layoutPanel.add(image);
		layoutPanel.setWidgetLeftWidth(image, 25.0, Unit.PX, 211.0, Unit.PX);
		layoutPanel.setWidgetTopHeight(image, 19.0, Unit.PX, 261.0, Unit.PX);
		image.setSize("211", "261");
	}
}
